package edu.xmut.kakamusic.utils;

import com.github.leonardoxh.livedatacalladapter.LiveDataCallAdapterFactory;
import com.github.leonardoxh.livedatacalladapter.LiveDataResponseBodyConverterFactory;

import java.io.IOException;

import okhttp3.Interceptor;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;

public class RequestUtils {

//        public static final String BASE_URL = "http://47.115.139.249:8000";
//    public static final String BASE_URL = "http://192.168.123.110:3900";
    public static final String BASE_URL = "http://192.168.144.211:3900";
//    public static final String BASE_URL = "http://10.22.166.134:3900";

    private static class InnerClass {
        public final static Retrofit retrofit = new Retrofit.Builder()
                .baseUrl(BASE_URL)
                .addCallAdapterFactory(LiveDataCallAdapterFactory.create())
                .addConverterFactory(LiveDataResponseBodyConverterFactory.create())
                .addConverterFactory(GsonConverterFactory.create())
                .build();
    }


    public static API getInstance() {
        return InnerClass.retrofit.create(API.class);
    }
}
